package cn.gson.crm.test;

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.domain.PageRequest;

import cn.gson.crm.model.dao.CustomerinfoIDAO;
import cn.gson.crm.model.pojo.Customerinfo;
import cn.gson.crm.service.CustomerinfoService;

public class demotest1 {

	private CustomerinfoIDAO  csDAO;
	private CustomerinfoService csinfoService;
	
	@Before
	public void setup(){
		ApplicationContext ac = 
				new ClassPathXmlApplicationContext("applicationContext-db.xml");
		csDAO=ac.getBean(CustomerinfoIDAO.class);
	}
	
	@After
	public void tearDown(){
		csinfoService=null;
	}
	@Test
	public void testgetAll(){
		PageRequest p = new PageRequest(2 - 1, 4);
		List<Customerinfo> list=csDAO.queryByPage(p);
		for(Customerinfo e:list ){
			System.out.println(e.getCustId()+"    "+e.getCjustKinds()+"   "+e.getCustAddress()+"   "
					+e.getCustCname()+"   "+e.getCustName()+"   "+e.getCustPhone()+"    "+e.getCustOperat()+"    "+e.getCustRemarks()
					+"   "+e.getCustSrc()+"  "+e.getCustCreatedata3()+"    "+e.getCustUpdate());
		}
	}
}
